<?php

/**
 * Provinces filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseProvincesFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'SNAME_THAI'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'SNAME_ENG'          => new sfWidgetFormFilterInput(),
      'IGEOGRAPHIC_REGION' => new sfWidgetFormFilterInput(),
      'ISTATION_ID'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'SNAME_THAI'         => new sfValidatorPass(array('required' => false)),
      'SNAME_ENG'          => new sfValidatorPass(array('required' => false)),
      'IGEOGRAPHIC_REGION' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ISTATION_ID'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('provinces_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Provinces';
  }

  public function getFields()
  {
    return array(
      'IPROVINCE_ID'       => 'Number',
      'SNAME_THAI'         => 'Text',
      'SNAME_ENG'          => 'Text',
      'IGEOGRAPHIC_REGION' => 'Number',
      'ISTATION_ID'        => 'Number',
    );
  }
}
